home *** CD-ROM | disk | FTP | other *** search
- Path: news.princeton.edu!blume
- From: blume@zayin.cs.princeton.edu (Matthias Blume)
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Performance: C vs. C++
- Date: 28 Jan 1996 02:25:23 GMT
- Organization: Princeton University
- Distribution: world
- Message-ID: <BLUME.96Jan27212523@zayin.cs.princeton.edu>
- References: <3105E9DC.1BE3@enermet.fi> <DLr46y.7rH@txnews.amd.com>
- <BLUME.96Jan27152610@zayin.cs.princeton.edu>
- <DLv2zC.A8z@research.att.com>
- NNTP-Posting-Host: zayin.cs.princeton.edu
- In-reply-to: ark@research.att.com's message of Sat, 27 Jan 1996 22:40:24 GMT
-
- In article <DLv2zC.A8z@research.att.com> ark@research.att.com (Andrew Koenig) writes:
-
- If you try the exercise of taking a C++ program that makes
- significant use of virtual functions and hand-translating it
- to C, you may discover that this statement is no more true
- [ ... than another bad comparison ... ]
-
- You are right, and you are wrong. It would be hard to translate a C++
- program into a C program by hand, because C++ is a horribly
- complicated language, with many gratuitous "features" that are
- supposed to make is "more efficient", and which on the other hand
- lacks some essential properties that every modern programming language
- should have. The troubles you allude to are not so much due to the
- problems with virtual functions, they have a lot to do with the
- so-called "design" of the language as a whole.
-
- I have written significant amounts of code in C, which make extensive
- use of function pointers. Function pointers have been the least of my
- headache in such code. When I write functional programs (which I do
- most of the time now), the use of functions as data has become even
- more second nature.
-
- Also, in the foregoing discussion I haven't been suggesting you should
- hand-translate C++ code to C. I merely pointed out, that the
- equivalent of virtual functions is not a "switch" (you will be hard
- pressed to show that you can hand-translate heavy "virtual" C++ code
- to C code using "switch" with more ease than using function pointers).
-
- --
- -Matthias
-